import { selectPage } from '@/services/financial/vip';
import { ProTable } from '@ant-design/pro-components';
import { Fragment, useRef } from 'react';
import { columns } from './columns';
import './index.less';

export default () => {
  const ref = useRef();
  return (
    <Fragment>
      <ProTable
        headerTitle="总分润金额"
        actionRef={ref}
        options={false}
        defaultSize="small"
        form={{
          defaultCollapsed: false,
        }}
        search={{
          labelWidth: 'auto',
          style: {
            padding: '24px 12px',
          },
        }}
        request={async (params = {}) => {
          const { current, pageSize, ...formData } = params;
          let body = {
            ...formData,
            pageNum: current,
            pageSize,
          };
          const { code, result } = await selectPage(body);
          if (code && code === 200) {
            return {
              data: result.records || [],
              total: result.total,
              success: true,
            };
          }
        }}
        pagination={{
          showSizeChanger: true,
        }}
        cardProps={{
          size: 'small',
          style: {
            padding: 0,
          },
        }}
        cardBordered={true}
        columns={columns()}
        rowKey="supplierId"
        scroll={{ x: 1300 }}
      />
    </Fragment>
  );
};
